package com.zxx.pattern.chainPattern.chain3;

/**
 * @author zxx on 2021/2/22
 */
public class ClientChain3 {

    public static void main(String[] args) {
        AbstractHandler handler1 = new Handler1();
        AbstractHandler handler2 = new Handler2();
        AbstractHandler handler3 = new Handler3();

        handler1.nextHandler = handler2;
        handler2.nextHandler = handler3;

        AbstractRequest request1 = new Request1("Re11");
        AbstractRequest request2 = new Request2("Re222");
        AbstractRequest request3 = new Request3("re33");

        //总是从链式顶端发起请求
        handler1.handleRequest(request1);
        handler1.handleRequest(request2);
        handler1.handleRequest(request3);
    }

}
